package cn.edu;

import cn.edu.config.SpringConfig;
import cn.edu.dao.BookDao;
import cn.edu.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author Davey chan
 */
public class AppForAnnotation {
    public static void main(String[] args) {
//        等价于将配置类
        ApplicationContext ctx=new AnnotationConfigApplicationContext(SpringConfig.class);
        BookDao bookDao =  ctx.getBean(BookDao.class);
        bookDao.save();
        BookService bean = ctx.getBean(BookService.class);
        System.out.println(bean);

    }
}
